package net.alipay;



import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class ali {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016100100638642";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDUziChH2GQPgKe2wbDw4Tr3OFFXg/9Ln5yjl4V8qyJYSIo12rhCJQPa+Hc4ItvzdnOmUmY4X6olewaCw8HJC7TGmPBvZ/DWxHsSE/a4qfSWNCxldvMxt4bfiS5vWm+dyox7xUCTTkPiJ1BilLibw0vf34OJfIBiR2kJMAyWQxiihxp4txs6ZoY0QvoH+O/9LH7W7DZTTuGfuIEH7NqEfUbwefXoJj4iptYnlmI2lrfetlx9jckk7LZR5UxztXs29AJCihX7SiqQC+qJwZcG9OjOuF/eAsNFMNbmYdsF9wPlT2z3ZKN156O3d29UX2FMAU1qaz8nJrwVcpnOdkWPeU3AgMBAAECggEATociE1L5NbksTmKUxHjJ/B+uIWLsk4kssClJHuBGOwvVBy03C4OW33n4BwH1cnSMA2kdd4T+sEdisNmT2hbIEK6UUVIgOn7IxmCI10T8mOqdWGrsiUx5ebu64a+77cUblQGcxxSoEctf/GeG3ngMbZKmeaIXA+oNPh0xr2Kc519S9V4s+IRkyO0Ez2SfSzZl2edjUGoIusjyWyXkA37iGSbXsiaTq8iItCnWEjoDuPoCkenasFJp73HuKxn/ersJr1bMXAPTUM2FhD04oGGPYkJhlRJC/Qq9ZxlM5cxeMlwtq523MtP3CoB5Rm9R+tDswUpJVEMFlAb3IE6YpVQvwQKBgQD9W/CrDWsKVfuTUIYMs6/3Hw5CWI3f/Uo25242+fSiEUCxHrBt4uCvOlp6vJW9XhcaKngGe1nfMt7a8EImJFIF9lp5+bFC+0OLPjQJieD9L50oFvX4njRGZuk8vsz/9UwirunrzBTsbD5FCKa34+MvliMLqNpPeANlLxxO22db2wKBgQDXBflIFQrpYp0YbdYmJQVKT+zr1mQkBFGTcR7oJDT6CaXffL79ajf5iIRKjslWQSNvNhX63RVN1FoEji/Yd2JdUD8YyUXP9JadoNkF0rb8sDsyLG0nht3WRy9GiXUo1wVxUInvlFYcbhUDa1MI7mql1n77G5E+RPSIM5EJ+gDo1QKBgQCChTTMyhLUtkruL1N/g6opIuSTpU8hjzkGY99Rjx9Jxp2PIYI+edzKKMOn6zMw5SH9ptdCb5Vy+J/6Jj/NqnRfAfTGVa3OFedL+nWQXGl9xWOu3XVF6SqBAk8xrhGp4tKgI3/6q54z1eeWZMiOf2Xwg+X2AbzFp8wH+mcY8MqkdQKBgQDUx3eQiio7G7fjlcWGB7p9eCw2kPiV36QuKJHyHOpDyEpZpyOEuJjdmOd4tGWuslTzV21Wy3KqiwntWhsktbckKiXWTE6GZD6ri6FXLtafpXFezDHUHJTn15eD0MCcgnNDV/S3nW29Qn4O3STVQMFOjL0plnUbTrdBFO5hFgHSZQKBgQCD2P+KYLUrHRL1aN8fIFFOF+gSA4kSaYwdAic4s54tgMT5IizKTzEzja2S8IV1Ef8j/Y1phlkgeD+FGnaeMLh2ENhOVXawLXr4iJOEGO4ZzFSuH9NHaZdoQKcQRckAjd8PASAZ2e9wTRkXR4Nwz62ia+X1JdpoXf6wxuV1nA7pgw==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1M4goR9hkD4CntsGw8OE69zhRV4P/S5+co5eFfKsiWEiKNdq4QiUD2vh3OCLb83ZzplJmOF+qJXsGgsPByQu0xpjwb2fw1sR7EhP2uKn0ljQsZXbzMbeG34kub1pvncqMe8VAk05D4idQYpS4m8NL39+DiXyAYkdpCTAMlkMYoocaeLcbOmaGNEL6B/jv/Sx+1uw2U07hn7iBB+zahH1G8Hn16CY+IqbWJ5ZiNpa33rZcfY3JJOy2UeVMc7V7NvQCQooV+0oqkAvqicGXBvTozrhf3gLDRTDW5mHbBfcD5U9s92Sjdeejt3dvVF9hTAFNams/Jya8FXKZznZFj3lNwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8080/userorder/payReturn.do";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "D:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

